package CPOO;

import javax.swing.ImageIcon;

public class PictureCompare extends javax.swing.JFrame {

    public PictureCompare() {
        initComponents();
    }
    
    public void setImage(String urlBefore, String urlAfter) {
        
        ImageIcon backgroundBefore = new ImageIcon(urlBefore);
        ImageIcon backgroundAfter = new ImageIcon(urlAfter);
        
        imageBeforeFiltration.setBounds(NORMAL, NORMAL, backgroundBefore.getIconWidth(), 
                backgroundBefore.getIconHeight());
        imageAfterFiltration.setBounds(NORMAL, NORMAL, backgroundAfter.getIconWidth(), 
                backgroundAfter.getIconHeight());
        imageBeforeFiltration.setIcon(backgroundBefore);
        imageAfterFiltration.setIcon(backgroundAfter);
        imageBeforeAlgorithmPanel.add(imageBeforeFiltration);
        imageAfterAlgorithmPanel.add(imageAfterFiltration);
        
        this.setVisible(true);
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        imageBeforeAlgorithmPanel = new javax.swing.JPanel();
        imageBeforeFiltration = new javax.swing.JLabel();
        imageAfterAlgorithmPanel = new javax.swing.JPanel();
        imageAfterFiltration = new javax.swing.JLabel();
        imageBeforeInfoPanel = new javax.swing.JPanel();
        jSeparator2 = new javax.swing.JSeparator();
        beforeFiltrationLabel = new javax.swing.JLabel();
        imageAfterInfoPanel = new javax.swing.JPanel();
        jSeparator1 = new javax.swing.JSeparator();
        afterFiltrationLabel = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        imageBeforeAlgorithmPanel.setAutoscrolls(true);

        imageBeforeFiltration.setText("jLabel3");
        imageBeforeFiltration.setAutoscrolls(true);

        javax.swing.GroupLayout imageBeforeAlgorithmPanelLayout = new javax.swing.GroupLayout(imageBeforeAlgorithmPanel);
        imageBeforeAlgorithmPanel.setLayout(imageBeforeAlgorithmPanelLayout);
        imageBeforeAlgorithmPanelLayout.setHorizontalGroup(
            imageBeforeAlgorithmPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(imageBeforeAlgorithmPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(imageBeforeFiltration)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        imageBeforeAlgorithmPanelLayout.setVerticalGroup(
            imageBeforeAlgorithmPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(imageBeforeAlgorithmPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(imageBeforeFiltration)
                .addContainerGap(570, Short.MAX_VALUE))
        );

        imageAfterAlgorithmPanel.setAutoscrolls(true);

        imageAfterFiltration.setText("jLabel4");

        javax.swing.GroupLayout imageAfterAlgorithmPanelLayout = new javax.swing.GroupLayout(imageAfterAlgorithmPanel);
        imageAfterAlgorithmPanel.setLayout(imageAfterAlgorithmPanelLayout);
        imageAfterAlgorithmPanelLayout.setHorizontalGroup(
            imageAfterAlgorithmPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(imageAfterAlgorithmPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(imageAfterFiltration)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        imageAfterAlgorithmPanelLayout.setVerticalGroup(
            imageAfterAlgorithmPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(imageAfterAlgorithmPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(imageAfterFiltration)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        beforeFiltrationLabel.setText("Obraz przed filtracją");

        javax.swing.GroupLayout imageBeforeInfoPanelLayout = new javax.swing.GroupLayout(imageBeforeInfoPanel);
        imageBeforeInfoPanel.setLayout(imageBeforeInfoPanelLayout);
        imageBeforeInfoPanelLayout.setHorizontalGroup(
            imageBeforeInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jSeparator2, javax.swing.GroupLayout.Alignment.TRAILING)
            .addGroup(imageBeforeInfoPanelLayout.createSequentialGroup()
                .addGap(213, 213, 213)
                .addComponent(beforeFiltrationLabel)
                .addContainerGap(194, Short.MAX_VALUE))
        );
        imageBeforeInfoPanelLayout.setVerticalGroup(
            imageBeforeInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, imageBeforeInfoPanelLayout.createSequentialGroup()
                .addContainerGap(14, Short.MAX_VALUE)
                .addComponent(beforeFiltrationLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        afterFiltrationLabel.setText("Obraz po filtracji");

        javax.swing.GroupLayout imageAfterInfoPanelLayout = new javax.swing.GroupLayout(imageAfterInfoPanel);
        imageAfterInfoPanel.setLayout(imageAfterInfoPanelLayout);
        imageAfterInfoPanelLayout.setHorizontalGroup(
            imageAfterInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING)
            .addGroup(imageAfterInfoPanelLayout.createSequentialGroup()
                .addGap(188, 188, 188)
                .addComponent(afterFiltrationLabel)
                .addContainerGap(216, Short.MAX_VALUE))
        );
        imageAfterInfoPanelLayout.setVerticalGroup(
            imageAfterInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, imageAfterInfoPanelLayout.createSequentialGroup()
                .addContainerGap(14, Short.MAX_VALUE)
                .addComponent(afterFiltrationLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(imageBeforeInfoPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(imageBeforeAlgorithmPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(imageAfterInfoPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(imageAfterAlgorithmPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(imageBeforeInfoPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(imageAfterInfoPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(imageBeforeAlgorithmPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(imageAfterAlgorithmPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel afterFiltrationLabel;
    private javax.swing.JLabel beforeFiltrationLabel;
    private javax.swing.JPanel imageAfterAlgorithmPanel;
    private javax.swing.JLabel imageAfterFiltration;
    private javax.swing.JPanel imageAfterInfoPanel;
    private javax.swing.JPanel imageBeforeAlgorithmPanel;
    private javax.swing.JLabel imageBeforeFiltration;
    private javax.swing.JPanel imageBeforeInfoPanel;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    // End of variables declaration//GEN-END:variables
}
